import { PatientsList } from '@/interfaces/patients'
import { createGetRequest, createPostRequest } from '@/utils/request'
// 添加患者
const addPatients = async (values) => {
    return await createPostRequest('/patients/add', values)
}

// 获取患者信息
const getPatientsInfo = async (patientNumber) => {
    return await createGetRequest('/patients/info', { patientNumber })
}

// 获取患者列表
const getPatientsList = async (params): Promise<PatientsList> => {
    return await createGetRequest('/patients/list', params)
}

// 删除患者
const deletePatient = async (patientnumber) => {
    return await createPostRequest('/patients/delete', { patientnumber })
}

// 修改患者
const editPatient = async (patientnumber, values) => {
    return await createPostRequest('/patients/edit', { patientnumber, ...values })
}

const patientsSearch = async (name) => {
    return await createGetRequest('/patients/search', { condition: name })
}

export {
    addPatients,
    getPatientsInfo,
    getPatientsList,
    deletePatient,
    editPatient,
    patientsSearch
}